﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" MaintainScrollPositionOnPostback="true"
    CodeBehind="Default.aspx.cs" Inherits="Fakebook._Default" %>

<%@ Register src="Shared/UcNestedPost.ascx" tagname="UcNestedPost" tagprefix="uc1" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
    <style type="text/css">
        .nav_header
        {
            background-color:Blue;
            color:White;    
            float:left;
            width:100%;
        }
        .l
        {
            float:left;    
        }
        .r
        {
            float:right;    
        }
    </style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    



    <div>
        <div>
            Write Post
        </div>
        <div>
            <asp:TextBox ID='txtPost' runat='server'></asp:TextBox>
            <asp:HiddenField ID="hfImage" runat="server" />
            <br />
            <asp:FileUpload ID="fuImage" runat="server" />
&nbsp;<asp:SqlDataSource ID="postSource" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                InsertCommand="INSERT INTO Post(UserId, Detail, Headline,ImageUrl) VALUES (NULL, N'', @Headline,@ImageUrl)" 
                SelectCommand="select * from POST order by POSTID desc">
                <InsertParameters>
                    <asp:ControlParameter ControlID="txtPost" Name="Headline" PropertyName="Text" />
                    <asp:ControlParameter ControlID="hfImage" Name="ImageUrl" 
                        PropertyName="Value" />
                </InsertParameters>
            </asp:SqlDataSource>
            <asp:Button ID="btnPost" runat="server" onclick="btnPost_Click" Text="Post" />
            <br />
            <br />
            <br />
            <asp:DataList ID="dlAnswer" runat="server" 
                onitemdatabound="dlAnswer_ItemDataBound" DataKeyField="PostId" 
                DataSourceID="postSource">
                <ItemTemplate>
                    <uc1:UcNestedPost ID="ucNested" runat="server" HfPostId='<%# Eval("PostId") %>' />
                </ItemTemplate>
                <AlternatingItemStyle BackColor="orange" />
                <ItemStyle BackColor="white" />

            </asp:DataList>
            <br />
            <br />

        </div>
    </div>

    <div>
        
    </div>


</asp:Content>
